Home of Quarkus Cheat |
您所在的位置:网站首页 › quarkus aop › Home of Quarkus Cheat |
Kubernetes
Quarkus can use Dekorate to generate Kubernetes resources. ./mvnw quarkus:add-extensions -Dextensions="quarkus-kubernetes"Running ./mvnw package the Kubernetes resources are created at target/kubernetes/ directory. Container Images Creation integrates with Kubernetes extension, so no need of extra Kubernetes properties.Generated resource is integrated with MicroProfile Health annotations. Also, you can customize the generated resource by setting the new values in application.properties: quarkus.kubernetes.namespace=mynamespace quarkus.kubernetes.replicas=3 quarkus.kubernetes.labels.foo=bar quarkus.kubernetes.readiness-probe.period-seconds=45 quarkus.kubernetes.mounts.github-token.path=/deployment/github quarkus.kubernetes.mounts.github-token.read-only=true quarkus.kubernetes.secret-volumes.github-token.volume-name=github-token quarkus.kubernetes.secret-volumes.github-token.secret-name=greeting-security quarkus.kubernetes.secret-volumes.github-token.default-mode=420 quarkus.kubernetes.config-map-volumes.github-token.config-map-name=my-secret quarkus.kubernetes.expose=true quarkus.kubernetes.ingress.expose=true quarkus.kubernetes.ingress.host=example.com quarkus.kubernetes.env.vars.my-env-var=foobar quarkus.kubernetes.env.configmaps=my-config-map,another-config-map quarkus.kubernetes.env.secrets=my-secret,my-other-secret quarkus.kubernetes.resources.requests.memory=64Mi quarkus.kubernetes.resources.requests.cpu=250m quarkus.kubernetes.resources.limits.memory=512Mi quarkus.kubernetes.resources.limits.cpu=1000mAll possible values are explained at https://quarkus.io/guides/kubernetes#configuration-options. Labels and Annotations The generated manifest use the Kubernetes recommended labels and annotations. "labels" : { "app.kubernetes.io/part-of" : "todo-app", "app.kubernetes.io/name" : "todo-rest", "app.kubernetes.io/version" : "1.0-rc.1" } "annotations": { "app.quarkus.io/vcs-url" : "", "app.quarkus.io/commit-id" : "", }You can override the labels by using the next properties: quarkus.kubernetes.part-of=todo-app quarkus.kubernetes.name=todo-rest quarkus.kubernetes.version=1.0-rc.1Or add new labels and/or annotations: quarkus.kubernetes.labels.foo=bar quarkus.kubernetes.annotations.foo=barmetrics When using metrics extension, Prometheus annotations are generated: prometheus.io/scrape: "true" prometheus.io/path: /metrics prometheus.io/port: "8080"Kubernetes Deployment Targets You can generate different resources setting the property quarkus.kubernetes.deployment-target. Possible values are kubernetes, openshift and knative. The default value is kubernetes. Knative Properties Most of the Kubernetes properties are valid in Knative output by just changing the kubernetes prefix to knative prefix (ie quarkus.kubernetes.readiness-probe.period-seconds to quarkus.knative.readiness-probe.period-seconds). There are also specific properties for Knative: quarkus.kubernetes.deployment-target=knative quarkus.knative.revision-name=my-revision quarkus.knative.traffic.my-revision.percentage=80List of configuration options: kuberneteshttps://quarkus.io/guides/kubernetes#configuration-options openshifthttps://quarkus.io/guides/kubernetes#openshift Knativehttps://quarkus.io/guides/kubernetes#knative Using Existing Resources You an provide your Kubernetes resources in form of yaml/json and they will provide additional resources or be used as base for the generation process: Resources are added in src/main/kubernetes directory with the target name (kubernetes.json, openshift.json, knative.json, or the yml equivalents) with one orm ore Kubernetes resources. Any resource found will be added in the generated manifests. If one of the provided resources has the same name as one of the generated ones, then the generated resource will be created on top of the provided resource, respecting existing content. To override the name of the generated resource you can use: quarkus.kubernetes.name, quarkus.openshift.name and quarkus.knative.name. Deployment To deploy automatically the generated resources, you need to set quarkus.container.deploy flag to true. mvn clean package -Dquarkus.kubernetes.deploy=true If you set this flag to true, the build and push flags from container-image are set to true too.To deploy the application, the extension uses the https://github.com/fabric8io/kubernetes-client. All options described at Kubernetes Client are valid here. Kubernetes Service Binding Quarkus supports binding services to applications via the Service Binding Specification for Kubernetes. The following Quarkus extensions support this feature: quarkus-jdbc-mariadb quarkus-jdbc-mssql quarkus-jdbc-mysql quarkus-jdbc-postgresql quarkus-kafka-client quarkus-smallrye-reactive-messaging-kafka quarkus-mongodb ./mvnw quarkus:add-extensions -Dextensions="quarkus-kubernetes-service-binding"Datasource configuration part is absent as it is auto-discovered by Quarkus. |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |